import java.io.File;
import java.io.IOException;

public class Demo3 {
    public static void main(String[] args) throws IOException {
        //1.创建文件
        File file1 = new File("text1.txt");
        System.out.println(file1.exists());
        file1.createNewFile();

        //2.修改文件名
        File file2 = new File("text2.txt");
        System.out.println(file1.exists());
        file1.renameTo(file2);
    }
}
